package org.rambadger.command.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Pattern;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Validates that the String is looks like it could be an {@link org.bson.types.ObjectId}
 */
@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER, TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy = {})
@Documented
@Pattern(regexp = "^[0-9A-Fa-f]{24}$")
public @interface MongoObjectId {
    String message() default "String does not look like a mongo ObjectId";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
